//
// chartype.c
//
// Character classification for shell
//
// Copyright (C) 2011 Michael Ringgaard. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 
// 1. Redistributions of source code must retain the above copyright 
//    notice, this list of conditions and the following disclaimer.  
// 2. Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.  
// 3. Neither the name of the project nor the names of its contributors
//    may be used to endorse or promote products derived from this software
//    without specific prior written permission. 
// 
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
// SUCH DAMAGE.
// 

#include "sh.h"

//
// Character class table 
//

const unsigned short ctype[CHAR_RANGE] = {
  // 0x00
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  C_UNDEF, C_SPACE, C_SPACE, C_UNDEF, C_UNDEF, C_SPACE, C_UNDEF, C_UNDEF,
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  // 0x20
  C_SPACE, C_SPCL,  C_DESC|C_QUOT,      C_SPCL,  C_SPCL|C_DESC,  C_UNDEF, C_UNDEF, C_QUOT,
  C_CTRL,  C_CTRL,  C_SPCL|C_ESC, C_UNDEF, C_UNDEF, C_SPCL,  C_UNDEF, C_UNDEF,
  C_DIGIT, C_DIGIT, C_DIGIT,      C_DIGIT, C_DIGIT, C_DIGIT, C_DIGIT, C_DIGIT,
  C_DIGIT,  C_DIGIT, C_UNDEF,      C_CTRL,  C_UNDEF, C_UNDEF, C_UNDEF, C_SPCL|C_ESC,
  // 0x40
  C_SPCL,  C_UPPER, C_UPPER, C_UPPER, C_UPPER, C_UPPER, C_UPPER, C_UPPER,
  C_UPPER, C_UPPER, C_UPPER, C_UPPER, C_UPPER, C_UPPER, C_UPPER, C_UPPER,
  C_UPPER, C_UPPER, C_UPPER, C_UPPER, C_UPPER, C_UPPER, C_UPPER, C_UPPER,
  C_UPPER, C_UPPER, C_UPPER, C_ESC,   C_ESC,   C_ESC,   C_UNDEF, C_NAME,
  // 0x60
  C_DESC|C_QUOT,  C_LOWER, C_LOWER, C_LOWER, C_LOWER, C_LOWER, C_LOWER, C_LOWER,
  C_LOWER, C_LOWER, C_LOWER, C_LOWER, C_LOWER, C_LOWER, C_LOWER, C_LOWER,
  C_LOWER, C_LOWER, C_LOWER, C_LOWER, C_LOWER, C_LOWER, C_LOWER, C_LOWER,
  C_LOWER, C_LOWER, C_LOWER, C_UNDEF, C_CTRL,  C_UNDEF, C_UNDEF, C_UNDEF,
  // 0x80
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  // 0xa0
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  // 0xc0
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  // 0xe0
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
  C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF, C_UNDEF,
};
